﻿@using KC.MVC.Core.Constants
@using KC.Web.Account.Constants
@using Microsoft.AspNetCore.Authorization
@model KC.DTO.Account.PermissionDTO
@inject IAuthorizationService AuthorizationService

<form class="easyui-form" method="post" data-options="novalidate:true" id="saveform" action="@Url.Action(ActionName.Permission.SavePermission, ControllerName.Permission)">

    @Html.AntiForgeryToken()
    @Html.HiddenFor(model => model.id)
    @Html.HiddenFor(model => model.id)
    @Html.HiddenFor(model => model.ApplicationId)
    @Html.HiddenFor(model => model.ApplicationName)
    @Html.HiddenFor(model => model.IsEditMode)
    @Html.HiddenFor(model => model.IsDeleted)
    @Html.HiddenFor(model => model.CreatedBy)
    @Html.HiddenFor(model => model.CreatedDate)
    @Html.HiddenFor(model => model.ModifiedBy)
    @Html.HiddenFor(model => model.ModifiedDate)
    <style>
        span.textbox.combo.textbox-readonly input.textbox-text.validatebox-text.validatebox-readonly.validatebox-f {
            background-color: darkgrey;
        }
    </style>

    <table class="dialog-form-table">
        <tbody>
            <tr>
                <td><label for="ParentId">父节点：</label></td>
                <td>
                    <input id="ParentId" name="ParentId" class="textbox" value="@(null != Model ? Model.ParentId : null)" style="width: 200px; height: 26px;">
                </td>
            </tr>

            <tr>
                <td><label class="required">*</label><label for="ResultType">返回数据类型：</label></td>
                <td>@Html.DropDownList("ResultType", (IEnumerable<SelectListItem>)ViewBag.ResultTypes, new { @id = "ResultType", @class = "easyui-combobox", @style = "width: 200px;height:26px;" })</td>
            </tr>
            <tr>
                <td><label class="required">*</label><label for="text">名称：</label></td>
                <td><input id="text" name="text" class="easyui-validatebox textbox" data-options="required:true,width:200,validType:'length[2,60]'" value="@(null != Model ? Model.text : string.Empty)" /></td>
            </tr>
            <tr>
                <td><label for="AreaName">Area名称：</label></td>
                <td><input id="AreaName" name="AreaName" class="easyui-validatebox textbox" data-options="width:200,validType:'length[2,60]'" style="background-color: darkgrey" value="@(null != Model ? Model.AreaName : string.Empty)" /></td>
            </tr>
            <tr>
                <td><label class="required">*</label><label for="ControllerName">Controller名称：</label></td>
                <td><input id="ControllerName" name="ControllerName" class="easyui-validatebox textbox" style="background-color: darkgrey" data-options="required:true,width:200,validType:'length[2,64]'" value="@(null != Model ? Model.ControllerName : string.Empty)" /></td>
            </tr>
            <tr>
                <td><label class="required">*</label><label for="ActionName">Action名称：</label></td>
                <td><input id="ActionName" name="ActionName" class="easyui-validatebox textbox" style="background-color: darkgrey" data-options="required:true,width:200,validType:'length[2,64]'" value="@(null != Model ? Model.ActionName : string.Empty)" /></td>
            </tr>
            <tr></tr>
            <tr>
                <td><label class="required">*</label><label for="Index">排序:</label></td>
                <td><input id="Index" name="Index" class="easyui-numberspinner textbox" data-options="required:true,width:200,height:26,min:1,max:100" value="@(null != Model ? Model.Index : 0)"></td>
            </tr>
            <tr>
                <td><label for="Description">描述:</label></td>
                <td>
                    <textarea id="Description" name="Description" class="textarea" style="height: 60px; width: 195px;">@(null != Model ? Model.Description : "")</textarea>
                </td>
            </tr>
        </tbody>
    </table>
</form>
<script>
    $(function () {

        $('.textbox').bind('blur', function () {
            $(this).validatebox('enableValidation').validatebox('validate');
        });

        $('#ParentId').combotree({
            url: '@Url.Action(ActionName.Permission.LoadPermissionTrees, ControllerName.Permission)',
            required: true,
        });

        //$('#ResultType').combobox({
        //    disabled: true
        //});


    });

</script>